package com.gg.user.gguser.controller;

import com.gg.user.gguser.service.GgRecommendServe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author yangxinlei
 * @date 2020/4/29
 */
@CrossOrigin
@RestController
@RequestMapping("/recommend")
public class GgRecommendController {

    @Autowired
    private GgRecommendServe ggRecommendServe;

    /**
     * APP 首页推荐
     * @param response
     * @param request
     * @return
     * @throws Exception
     */
    @PostMapping("/getRecommend")
    public Object getRecommend(HttpServletResponse response, HttpServletRequest request) throws Exception {
        return ggRecommendServe.getRecommend(response, request);
    }

    /**
     * APP 公司详情
     */
    @PostMapping("/getRecommendItems")
    public Object getRecommendItems(HttpServletResponse response, HttpServletRequest request,String id) throws Exception {
        return ggRecommendServe.getRecommendItems(response, request,id);
    }

    /**
     * APP 信息页面搜索
     */
    @PostMapping("/getRecommendQItems")
    public Object getRecommendQItems(HttpServletResponse response, HttpServletRequest request,String q,Integer page,Integer pageNumber) throws Exception {
        return ggRecommendServe.getRecommendQItems(response, request,q,page,pageNumber);
    }

    /**
     * APP 今日需要联系客户
     */
    @PostMapping("todayContactCustomer")
    public Object todayContactCustomer(HttpServletResponse response, HttpServletRequest request,Integer page,Integer pageNumber) throws Exception {
        return ggRecommendServe.todayContactCustomer(response, request,page,pageNumber);
    }

    /**
     * 马上到期客户
     * q搜索关键字
     */
    @PostMapping("todayDueCustomers")
    public Object todayDueCustomers(HttpServletResponse response, HttpServletRequest request,Integer page,Integer pageNumber) throws Exception {
        return ggRecommendServe.todayDueCustomers(response, request,page,pageNumber);
    }

}
